package com.itheima.iostream;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

public class Demo03 {
    public static void main(String[] args) {
        /*FileOutputStream fos=null;
        try {
            fos= new FileOutputStream("day12\\c.txt");
            fos.write("嘿嘿嘿,我最帅".getBytes());

        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            if(fos!=null){
                try {
                    fos.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }

        }*/

        //ctrl+alt+T选中 可能出现异常的代码 别选 释放资源的
        //ctrl+alt+T选中释放资源的代码
        //ctrl+alt+T 对数据进行非空判断
        FileOutputStream fos = null;
        try {
            fos = new FileOutputStream("day12\\c.txt");
            fos.write("嘿嘿嘿,我最帅".getBytes());
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (fos!=null) {
                try {
                    fos.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }

        }


    }

}
